--[[
--函数8:lua_video_get_docs_under_processing
--功能:获取state处于1生成中状态的文档的id的集合
--返回: 文档id的集合,半角逗号分隔 1,2,3,4
-- ]]--

-- key的连接符号
local PREFIX_S = ","
local PREFIX_X = "*"
local PREFIX_DOC = 'doc_id_'
local key = PREFIX_DOC..PREFIX_X
--查询state等于1的模板id的table
local l_keys = redis.call('keys',key)
local l_len = #l_keys
local midres = {}
for i=1, l_len do
    local key = l_keys[i]
    local state = redis.call("hget",key,"state")
    if(tonumber(state) == 1)
    then
        table.insert(midres,key)
    end
end
local m_len = #midres
if(m_len <= 0)
then
    return midres
end
--切割结果得到数字表
local s = #PREFIX_DOC + 1
local e = #midres[1]
local res = {}
for i=1, m_len do
    local id = string.sub(midres[i],s,e)
    table.insert(res,id)
end

return res